Ubuntu 14.04
Sponsored Link

Mail Log Analyzer - AWstats
2014/05/04
 
Install Mail Log Analyzer, AWstats.
[1]
[2] Install AWstats
root@mail:~#
apt-get -y install awstats
root@mail:~#
cp /etc/awstats/awstats.conf /etc/awstats/awstats.postfix.conf

root@mail:~#
cp /usr/share/doc/awstats/examples/maillogconvert.pl /usr/share/awstats

root@mail:~#
vi /etc/awstats/awstats.postfix.conf
# line 51: change

LogFile="
/usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |
"
# line 63: change

LogType=
M
# line 123 comment out and add the line below

#
LogFormat=4
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"
# line 154: specify hostname

SiteDomain="
mail.srv.world
"
# line 223: change

DirIcons="
./icon
"
# line 839: change like follows

LevelForBrowsersDetection=
0

LevelForOSDetection=
0

LevelForRefererAnalyze=
0

LevelForRobotsDetection=
0

LevelForSearchEnginesDetection=
0

LevelForKeywordsDetection=
0

LevelForFileTypesDetection=
0

LevelForWormsDetection=0
# line 957: change like follows

ShowMonthStats=
UHB

ShowDaysOfMonthStats=
HB

ShowDaysOfWeekStats=
HB

ShowHoursStats=
HB

ShowDomainsStats=
0

ShowHostsStats=
HBL

ShowRobotsStats=
0

ShowEMailSenders=
HBML

ShowEMailReceivers=
HBML

ShowSessionsStats=
0

ShowPagesStats=
0

ShowFileTypesStats=
0

ShowOSStats=
0

ShowBrowsersStats=
0

ShowOriginStats=
0

ShowKeyphrasesStats=
0

ShowKeywordsStats=
0

ShowMiscStats=
0

ShowHTTPErrorsStats=
0

ShowSMTPErrorsStats=
1
root@mail:~#
mkdir /var/www/html/awstats

root@mail:~#
ln -s /usr/share/awstats/icon /var/www/html/awstats/icon

root@mail:~#
vi /etc/apache2/sites-available/awstats.conf
# create new

<Directory /var/www/html/awstats>
    Require ip 127.0.0.1 10.0.0.0/24
</Directory>
root@mail:~#
a2ensite awstats

Enabling site awstats.
To activate the new configuration, you need to run:
  service apache2 reload

root@mail:~#
/etc/init.d/apache2 restart

* Restarting web server apache2
... waiting . ...done.
# generate reports

root@mail:~#
/usr/lib/cgi-bin/awstats.pl -config=postfix -update

Create/Update database for config "/etc/awstats/awstats.postfix.conf" by AWStats version 7.2 (build 1.992)
From data in log file "/usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Warning: awstats has detected that some hosts names were already resolved in your logfile /usr/share/awstats/maillogconvert.pl standard < /var/log/mail.log |.
If DNS lookup was already made by the logger (web server), you should change your setup DNSLookup=1 into DNSLookup=0 to increase awstats speed.
Jumped lines in file: 0
Parsed lines in file: 7
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 7 new qualified records.

# generate HTML from reports

root@mail:~#
/usr/lib/cgi-bin/awstats.pl -config=postfix -output -staticlink > /var/www/html/awstats/index.html

[3] Access to 'http://(your server's name or IP address)/awstats/' with web browser. Then following screen is shown and it's possible to make sure mail log summary.
 
Tweet